package day02;

import java.math.BigDecimal;

public class DoubleDemo {
    public static void main(String[] args) {
        double a = 22.51;
        float b = 78.5F;

        double c = 3.0,d = 2.9;
        System.out.println(c-d);//上飘
        double e = 9.8,f = 1.5;
        System.out.println(e-f);//无误差
        double g = 6,i = 4.9;
        System.out.println(g-i);//下飘

        //未解决,仍有误差
        BigDecimal bigDecimal1 = new BigDecimal(3.0);
        BigDecimal bigDecimal2 = new BigDecimal(2.9);
        BigDecimal bigDecimal = bigDecimal1.subtract(bigDecimal2);
        System.out.println(bigDecimal);
    }
}
